/**
 * This file is part of Idegen, the application to create IDE project files.
 *
 * @copyright Copyright (c) 2011-2012, Walter Tamboer http://waltertamboer.nl
 * @file Idegen/Idegen/IdegenGenerator.hpp
 */

#ifndef IDEGEN_IDEGEN_IDEGENGENERATOR_HPP
#define IDEGEN_IDEGEN_IDEGENGENERATOR_HPP

namespace Idegen
{
	class IdegenProject;
	class Settings;

	struct SettingsScope;

	enum IdegenGeneratorType;
	
	typedef std::vector< IdegenProject* > IdegenProjectList;

	/** The definition of a project. */
	class IdegenGenerator
	{
	public:
		/** Initializes a new instance of this class. */
		IdegenGenerator();

		/** Cleans up all the resources used by this class. */
		virtual ~IdegenGenerator();

		/**
		 * Gets the name of the generator.
		 *
		 * @return Returns an ANSI string.
		 */
		std::string GetName() const;

		/**
		 * Gets the output path for this generator.
		 *
		 * @return Returns a string.
		 */
		std::string GetOutputPath() const;

		/**
		 * Gets the list with projects.
		 *
		 * @return Returns a list with all the projects.
		 */
		IdegenProjectList GetProjects() const;

		/**
		 * Gets the type of the generator.
		 *
		 * @return Returns a GeneratorType value.
		 */
		IdegenGeneratorType GetType() const;

		/**
		 * Unserializes a generator.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The parent element.
		 */
		void Unserialize( Settings* settings, TiXmlElement* parent );

	private:
		/**
		 * Parses the needed attributes for the given generator element.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The Xml element that should be parsed.
		 */
		void ParseAttributes( Settings* settings, TiXmlElement* parent );
		
		/**
		 * Parses a project that is linked to the generator.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The Xml element that should be parsed.
		 */
		void ParseProject( Settings* settings, TiXmlElement* parent );
		
		/**
		 * Parses the projects of the generator.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The Xml element that should be parsed.
		 */
		void ParseProjects( Settings* settings, TiXmlElement* parent );

		/** The name of the generator. */
		std::string m_Name;
		
		/** The type of the generator. */
		IdegenGeneratorType m_Type;

		/** The output path of the generator. */
		std::string m_OutputPath;

		/** A list with all the projects that this generator has. */
		IdegenProjectList m_Projects;
	};

	typedef std::vector< IdegenGenerator* > IdegenGeneratorList;
}

#endif
